<template>
  <div>
    <div>
      <h1>用户列表页</h1>
      <button v-if="isadd" @click="tzadd"><router-link to="/layout/usrs/add">新增</router-link></button>
    </div>
    <div>
      <a-table  :columns="tbcls" :data-source="tbds" >
        <template #bodyCell="{ column, record }">
          <template v-if="column.key === 'action'">
        <span>
          <a>修改-{{ record.username }}</a>
          <a-divider type="vertical" />
          <a>删除</a>
          <a-divider type="vertical" />
          <a class="ant-dropdown-link">
            更多
            <down-outlined />
          </a>
        </span>
          </template>
        </template>

      </a-table>
    </div>
  </div>
</template>
<script setup>
import {ref,onMounted} from "vue";
import store from 'store'
import { useRouter } from 'vue-router'
const router = useRouter()

const isadd= ref(false)

const tzadd = () => {
  router.push("/layput/users/add")
}
const tbname = ref("系统用户数据列表")
const tbcls=[{
  name: '序号',
  title: '序号',
  dataIndex: 'id',
  key: 'id',
},
  {
  title: '账号',
  dataIndex: 'username',
  key: 'username',
},
  {
  title: '密码',
  dataIndex: 'password',
}, {
  title: '操作',
  key: 'action',
}];

const tbds=ref([
  {
    id:1,
    username:"test01",
    password:"123456"
  }
])

onMounted(async () => {
  var ps=store.get('perms');
  for(var i in ps){
    if(ps[i].permTag=='sysuser:add'){
      isadd.value=true;
    }
  }
})
</script>
